<?php

namespace app\controllers\h5\my;

use app\controllers\h5\base\H5Controller;
use app\models\user\UserPayPassword;

class UserController extends H5Controller
{
    public function actionPayPassword()
    {
        $password = $this->post('password');

        $model = UserPayPassword::findOne(['user_id' => $this->user->id]);
        if (!$model) {
            return $this->customFail('您还没有设置支付密码, 请先去个人中心设置');
        }

        if ($model->password != $password) {
            return $this->customFail('支付密码错误!');
        }

        return $this->success();
    }
}